/*
 * Server.java
 *
 * Created on 21 de marzo de 2008, 12:02 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package servidor;

/**
 *
 * @author Administrador
 */


import java.io.*;
import java.net.*;


public class Servidor
{
  
   public Servidor()
   { 
   }

   public void mostrar(String msg)
   {
       System.out.println(msg+"\n");
   }
   public void runServer()
   {
       
      ServerSocket serv=null;//para comunicacion
      ServerSocket serv2=null;//para enviar mensajes
      boolean listening=true;
      try{
         serv=new ServerSocket(8081);
         serv2=new ServerSocket(8082);
         mostrar(".::Servidor activo :");
         while(listening)
         {
            Socket sock=null,sock2=null;
            try {
               mostrar("Esperando Usuarios");
               sock=serv.accept();
               sock2=serv2.accept();
            } catch (IOException e)
            {
               mostrar("Accept failed: " + serv + ", " + e.getMessage());
               continue;
            }
            threadServidor user=new threadServidor(sock,sock2);            
            user.start();
         }
         
      }catch(IOException e){
        mostrar("error :"+e);
      }
   }
}



